import androidx.compose.foundation.layout.Column
import androidx.compose.material.*
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.window.singleWindowApplication
import cn.hutool.core.io.FileUtil
import java.awt.Desktop
import java.io.File
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

/**
 * @author wei kunJie
 * @date 2024/4/18 15:51:42
 */
@OptIn(ExperimentalMaterialApi::class)
fun main() = singleWindowApplication {
    val expanded = remember { mutableStateOf(false) }


        ExposedDropdownMenuBox(
            expanded = expanded.value,
            onExpandedChange = {
                expanded.value = !expanded.value
            },
            ) {
            Button(onClick = { expanded.value = true }) {
                Text("请点击")
            }
            ExposedDropdownMenu(expanded = expanded.value,
                onDismissRequest = {
                    expanded.value = false
                }){
                DropdownMenuItem(onClick = { println("11111${expanded.value}") }) {
                    Text("11111")
                }
                DropdownMenuItem(onClick = { println("2222${expanded.value}") }) {
                    Text("2222")
                }
            }

        }



}

fun getTimeString(dateTimeString: String): String {
    val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")
    val dateTime = LocalDateTime.parse(dateTimeString, formatter)
    val today = LocalDate.now()
    val yesterday = today.minusDays(1)
    val dayBeforeYesterday = today.minusDays(2)

    return when {
        dateTime.toLocalDate() == today -> dateTimeString.substring(11, 16)
        dateTime.toLocalDate() == yesterday -> "昨天"
        dateTime.toLocalDate() == dayBeforeYesterday -> "前天"
        else -> dateTime.toLocalDate().toString().replace("-", "/")
    }
}

class User(
    var uname: String,
    var pwd: String
)